//这是12.17 0.08
import management.Management;
import wty.Administrator;
import wty.ChangeAdministratorPassword;
import wty.Login;
import wty.Register;

import javax.swing.*;
import java.awt.*;

public class Main {
    public static JFrame frame;
    public static int a;

    public static void main(String[] args) {
//下面的部分无需修改,各个其他类中无需添加JFrame
        
        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Accounting management system");
//        frame.setSize(500, 300);
        frame.setSize(1000, 600);

        frame.setLayout(new CardLayout());// 使用 CardLayout 以便于切换面板

        //将每个对应界面写成一个静态的JPanel panel,默认设置为panel.setVisible(true),通过以下步骤设置Visible来实现相应的页面的关闭和打开
////待完善

        // 初始化各个面板
        Login login = new Login();
        Register register = new Register();
        Management management = new Management();
        Administrator administrator = new Administrator();
        ChangeAdministratorPassword changeAdministratorPassword = new ChangeAdministratorPassword();

        // 将面板添加到框架中
        frame.getContentPane().add(Login.panel, "Login");
        frame.getContentPane().add(Register.panel, "Register");
        frame.getContentPane().add(Management.panel, "Management");
        frame.getContentPane().add(Administrator.panel, "Administrator");
        frame.getContentPane().add(ChangeAdministratorPassword.panel, "ChangeAdministratorPassword");

        // 初始化
        Login.panel.setVisible(true);
        Register.panel.setVisible(false);
        Management.panel.setVisible(false);
        Administrator.panel.setVisible(false);
        ChangeAdministratorPassword.panel.setVisible(false);

        frame.setVisible(true);




////将每个对应界面写成一个静态的JPanel panel,默认设置为panel.setVisible(true),通过以下步骤设置Visible来实现相应的页面的关闭和打开
////待完善
//        Login login = new Login();
//        frame.getContentPane().add(Login.panel);
//        Login.panel.setVisible(true);
//
//        Register register = new Register();
//        frame.getContentPane().add(Register.panel);
//
////        Register.panel.setVisible(false);
//
//        Management management = new Management();
//        frame.getContentPane().add(Management.panel);
    }
}
